#ifndef OFFLINEMSG_COMMAND_IN_H_
#define OFFLINEMSG_COMMAND_IN_H_
#include "command.h"

#pragma pack(1)
namespace Cmd
{
        namespace OfflineMsg
        {
                //  cmd declaration
                enum {
                        CMDIN_LOGIN             = 0x0010,	// 登录RecordServer验证指令
                        CMDIN_SESSION           = 0x0011,	// 与SessionServer交互的指令
                };
                enum { //CMDIN_LOGIN
                        SCMDIN_LOGIN                    = 0x0001,	// 请求登录RecordServer
                        SCMDIN_LOGIN_RESPONCE           = 0x0002,	// 登录RecordServer返回
                };
                enum { //CMDIN_SESSION
                        SCMDIN_GET_OFFLINE_MSG          = 0x0000,
                        SCMDIN_SAVE_OFFLINE_MSG         = 0x0001,
                        SCMDIN_RES_OFFLINE_MSG          = 0x0002,
                };


                //	cmd definition
                struct stLoginCmd:t_NullCmd
                {
                        stLoginCmd():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN)
                        {
                                dest_type_ = OFFLINEMSGSERVER;
                                server_type_ = 0;
                                server_id_ = 0;
                        }
                        WORD dest_type_;
                        WORD server_type_;
                        DWORD server_id_;
                };
                struct stLoginResponce:t_NullCmd
                {
                        stLoginResponce():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN_RESPONCE)
                        {
                        }
                };

                struct stSessionGetOfflineMsg:
                        t_NullCmd
                {
                        stSessionGetOfflineMsg():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_GET_OFFLINE_MSG)
                        {
                                user_id_ = 0;
                                terminal_type = eTerminalType_pc;
                        }
                        DWORD user_id_;
                        uint8_t terminal_type;
                };
                struct stSessionSaveOfflineMsg:
                        t_NullCmd
                {
                        stSessionSaveOfflineMsg():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SAVE_OFFLINE_MSG)
                        {
                                user_id_ = 0;
                                size_ = 0;
                        }
                        DWORD user_id_;
                        WORD size_;
                        char data_[0];
                        DWORD getSize() {
                                return sizeof(*this)+size_*sizeof(data_[0]);
                        }
                };
                struct stSessionResOfflineMsg:
                        t_NullCmd
                {
                        stSessionResOfflineMsg():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_RES_OFFLINE_MSG)
                        {
                                user_id_ = 0;
                                size_ = 0;
                        }
                        DWORD user_id_;
                        WORD size_;
                        char data_[0];
                        DWORD getSize() {
                                return sizeof(*this)+size_*sizeof(data_[0]);
                        }
                };
        }; //namespace Record
}; //namespace Cmd
#pragma pack() //pack(1)

#endif //OFFLINEMSG_COMMAND_IN_H_
